using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vAcctBalanceMap : EntityTypeConfiguration<vAcctBalance>
    {
        public vAcctBalanceMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Acct, t.AcctDescrip, t.Currency, t.CurrSymb, t.TypeGen, t.headeracct });

            // Properties
            this.Property(t => t.Acct)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.subacct)
                .HasMaxLength(35);

            this.Property(t => t.AcctDescrip)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Currency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.CurrSymb)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Type)
                .HasMaxLength(11);

            this.Property(t => t.Class)
                .HasMaxLength(10);

            this.Property(t => t.Classification)
                .HasMaxLength(31);

            this.Property(t => t.SubType)
                .HasMaxLength(31);

            this.Property(t => t.TypeGen)
                .IsRequired()
                .HasMaxLength(3);

            // Table & Column Mappings
            this.ToTable("vAcctBalances");
            this.Property(t => t.Acct).HasColumnName("Acct");
            this.Property(t => t.Level).HasColumnName("Level");
            this.Property(t => t.subacct).HasColumnName("subacct");
            this.Property(t => t.AcctDescrip).HasColumnName("AcctDescrip");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.CurrSymb).HasColumnName("CurrSymb");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Class).HasColumnName("Class");
            this.Property(t => t.Classification).HasColumnName("Classification");
            this.Property(t => t.SubType).HasColumnName("SubType");
            this.Property(t => t.TypeGen).HasColumnName("TypeGen");
            this.Property(t => t.Begdrdol).HasColumnName("Begdrdol");
            this.Property(t => t.Begcrdol).HasColumnName("Begcrdol");
            this.Property(t => t.Begdr).HasColumnName("Begdr");
            this.Property(t => t.Begcr).HasColumnName("Begcr");
            this.Property(t => t.headeracct).HasColumnName("headeracct");
            this.Property(t => t.BalDol).HasColumnName("BalDol");
            this.Property(t => t.BalLL).HasColumnName("BalLL");
        }
    }
}
